import 'package:edu_assistant/generated/json/base/json_convert_content.dart';
import 'package:edu_assistant/model/message_entity.dart';

MessageEntity $MessageEntityFromJson(Map<String, dynamic> json) {
  final MessageEntity messageEntity = MessageEntity();
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    messageEntity.type = type;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    messageEntity.content = content;
  }
  return messageEntity;
}

Map<String, dynamic> $MessageEntityToJson(MessageEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['type'] = entity.type;
  data['content'] = entity.content;
  return data;
}

extension MessageEntityExtension on MessageEntity {
  MessageEntity copyWith({
    String? type,
    String? content,
  }) {
    return MessageEntity()
      ..type = type ?? this.type
      ..content = content ?? this.content;
  }
}